/*

	IMesh.h
	
	Header for the IMesh interface used as
	base class for all mesh types.
	
	Written by Sigurd Suhm 2009

*/

#ifndef _IMESH_H
#define _IMESH_H

// Includes
#include "Texture.h"		// Texture class header
#include "Vector.h"			// Vector classes

namespace EraAstral
{
	namespace graphics
	{
		// Struct for mesh indices
		typedef struct
		{
			// Index for current vertex, normal and texture coordinate
			int vertex, normal, texCoord;
		} IndexStruct;
	
		// Mesh interface
		class IMesh
		{
			protected:
				// Mesh vertices
				Vector3		*m_vertices;
				// Mesh normals
				Vector3		*m_normals;
				// Mesh texture coordinates
				Vector2		*m_texCoords;
				
				// Vertex, normal, tex coord and index count
				unsigned int m_vertexCount, m_normalCount, m_texCoordCount, m_indexCount;
				
				// Structure holding indices
				IndexStruct *m_indices; 
				
				// Indicates if the mesh has normals
				bool m_hasNormals;
				// Indicates if the mesh is textured
				bool m_hasTexture;
				
				// Mesh texture
				Texture *m_texture;
		
			public:
				// Base constructor
				IMesh();
				// Constructor holding vertex, normal, tex coord and index count
				IMesh(unsigned int vertexCount, unsigned int normalCount, unsigned int texCoordCount, unsigned int indexCount);
				// Virtual base destructor
				virtual ~IMesh();
				
				// Load a texture for the mesh
				virtual int  LoadTexture(const char *fileName) = 0;
				// Method for drawing the mesh
				virtual void Draw() = 0;
				
				// Accessors
				unsigned int 	GetVertexCount() const;
				bool			HasNormals() const;
				bool			HasTexture() const;
		};
	}
}

#endif		// _IMESH_H
